home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / info / lispref.info-35 < prev    next >
Encoding:
GNU Info File  |  1995-09-01  |  50.7 KB  |  1,276 lines

  1. This is Info file ../../info/lispref.info, produced by Makeinfo-1.63
  2. from the input file lispref.texi.
  3.  
  4.    Edition History:
  5.  
  6.    GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
  7. Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
  8. Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
  9. XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
  10. GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
  11. Programmer's Manual (for 19.13) Third Edition, July 1995
  12.  
  13.    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
  14. Foundation, Inc.  Copyright (C) 1994, 1995 Sun Microsystems, Inc.
  15. Copyright (C) 1995 Amdahl Corporation.  Copyright (C) 1995 Ben Wing.
  16.  
  17.    Permission is granted to make and distribute verbatim copies of this
  18. manual provided the copyright notice and this permission notice are
  19. preserved on all copies.
  20.  
  21.    Permission is granted to copy and distribute modified versions of
  22. this manual under the conditions for verbatim copying, provided that the
  23. entire resulting derived work is distributed under the terms of a
  24. permission notice identical to this one.
  25.  
  26.    Permission is granted to copy and distribute translations of this
  27. manual into another language, under the above conditions for modified
  28. versions, except that this permission notice may be stated in a
  29. translation approved by the Foundation.
  30.  
  31.    Permission is granted to copy and distribute modified versions of
  32. this manual under the conditions for verbatim copying, provided also
  33. that the section entitled "GNU General Public License" is included
  34. exactly as in the original, and provided that the entire resulting
  35. derived work is distributed under the terms of a permission notice
  36. identical to this one.
  37.  
  38.    Permission is granted to copy and distribute translations of this
  39. manual into another language, under the above conditions for modified
  40. versions, except that the section entitled "GNU General Public License"
  41. may be included in a translation approved by the Free Software
  42. Foundation instead of in the original English.
  43.  
  44. 
  45. File: lispref.info,  Node: Time Conversion,  Next: Timers,  Prev: Time of Day,  Up: System Interface
  46.  
  47. Time Conversion
  48. ===============
  49.  
  50.    These functions convert time values (lists of two or three integers)
  51. to strings or to calendrical information.  There is also a function to
  52. convert calendrical information to a time value.  You can get time
  53. values from the functions `current-time' (*note Time of Day::.) and
  54. `file-attributes' (*note File Attributes::.).
  55.  
  56.  - Function: format-time-string FORMAT-STRING TIME
  57.      This function converts TIME to a string according to
  58.      FORMAT-STRING.  The argument FORMAT-STRING may contain
  59.      `%'-sequences which say to substitute parts of the time.  Here is a
  60.      table of what the `%'-sequences mean:
  61.  
  62.     `%a'
  63.           This stands for the abbreviated name of the day of week.
  64.  
  65.     `%A'
  66.           This stands for the full name of the day of week.
  67.  
  68.     `%b'
  69.           This stands for the abbreviated name of the month.
  70.  
  71.     `%B'
  72.           This stands for the full name of the month.
  73.  
  74.     `%c'
  75.           This is a synonym for `%x %X'.
  76.  
  77.     `%C'
  78.           This has a locale-specific meaning.  In the default locale
  79.           (named C), it is equivalent to `%A, %B %e, %Y'.
  80.  
  81.     `%d'
  82.           This stands for the day of month, zero-padded.
  83.  
  84.     `%D'
  85.           This is a synonym for `%m/%d/%y'.
  86.  
  87.     `%e'
  88.           This stands for the day of month, blank-padded.
  89.  
  90.     `%h'
  91.           This is a synonym for `%b'.
  92.  
  93.     `%H'
  94.           This stands for the hour (00-23).
  95.  
  96.     `%I'
  97.           This stands for the hour (00-12).
  98.  
  99.     `%j'
  100.           This stands for the day of the year (001-366).
  101.  
  102.     `%k'
  103.           This stands for the hour (0-23), blank padded.
  104.  
  105.     `%l'
  106.           This stands for the hour (1-12), blank padded.
  107.  
  108.     `%m'
  109.           This stands for the month (01-12).
  110.  
  111.     `%M'
  112.           This stands for the minute (00-59).
  113.  
  114.     `%n'
  115.           This stands for a newline.
  116.  
  117.     `%p'
  118.           This stands for `AM' or `PM', as appropriate.
  119.  
  120.     `%r'
  121.           This is a synonym for `%I:%M:%S %p'.
  122.  
  123.     `%R'
  124.           This is a synonym for `%H:%M'.
  125.  
  126.     `%S'
  127.           This stands for the seconds (00-60).
  128.  
  129.     `%t'
  130.           This stands for a tab character.
  131.  
  132.     `%T'
  133.           This is a synonym for `%H:%M:%S'.
  134.  
  135.     `%U'
  136.           This stands for the week of the year (01-52), assuming that
  137.           weeks start on Sunday.
  138.  
  139.     `%w'
  140.           This stands for the numeric day of week (0-6).  Sunday is day
  141.           0.
  142.  
  143.     `%W'
  144.           This stands for the week of the year (01-52), assuming that
  145.           weeks start on Monday.
  146.  
  147.     `%x'
  148.           This has a locale-specific meaning.  In the default locale
  149.           (named C), it is equivalent to `%D'.
  150.  
  151.     `%X'
  152.           This has a locale-specific meaning.  In the default locale
  153.           (named C), it is equivalent to `%T'.
  154.  
  155.     `%y'
  156.           This stands for the year without century (00-99).
  157.  
  158.     `%Y'
  159.           This stands for the year with century.
  160.  
  161.     `%Z'
  162.           This stands for the time zone abbreviation.
  163.  
  164.  - Function: decode-time TIME
  165.      This function converts a time value into calendrical information.
  166.      The return value is a list of nine elements, as follows:
  167.  
  168.           (SECONDS MINUTES HOUR DAY MONTH YEAR DOW DST ZONE)
  169.  
  170.      Here is what the elements mean:
  171.  
  172.     SEC
  173.           The number of seconds past the minute, as an integer between
  174.           0 and 59.
  175.  
  176.     MINUTE
  177.           The number of minutes past the hour, as an integer between 0
  178.           and 59.
  179.  
  180.     HOUR
  181.           The hour of the day, as an integer between 0 and 23.
  182.  
  183.     DAY
  184.           The day of the month, as an integer between 1 and 31.
  185.  
  186.     MONTH
  187.           The month of the year, as an integer between 1 and 12.
  188.  
  189.     YEAR
  190.           The year, an integer typically greater than 1900.
  191.  
  192.     DOW
  193.           The day of week, as an integer between 0 and 6, where 0
  194.           stands for Sunday.
  195.  
  196.     DST
  197.           `t' if daylight savings time is effect, otherwise `nil'.
  198.  
  199.     ZONE
  200.           An integer indicating the time zone, as the number of seconds
  201.           east of Greenwich.
  202.  
  203.      Note that Common Lisp has different meanings for DOW and ZONE.
  204.  
  205.  - Function: encode-time SECONDS MINUTES HOUR DAY MONTH YEAR &optional
  206.           ZONE
  207.      This function is the inverse of `decode-time'.  It converts seven
  208.      items of calendrical data into a time value.  For the meanings of
  209.      the arguments, see the table above under `decode-time'.
  210.  
  211.      Year numbers less than 100 are treated just like other year
  212.      numbers.  If you want them to stand for years above 1900, you must
  213.      alter them yourself before you call `encode-time'.
  214.  
  215.      The optional argument ZONE defaults to the current time zone and
  216.      its daylight savings time rules.  If specified, it can be either a
  217.      list (as you would get from `current-time-zone') or an integer (as
  218.      you would get from `decode-time').  The specified zone is used
  219.      without any further alteration for daylight savings time.
  220.  
  221. 
  222. File: lispref.info,  Node: Timers,  Next: Terminal Input,  Prev: Time Conversion,  Up: System Interface
  223.  
  224. Timers for Delayed Execution
  225. ============================
  226.  
  227.    You can set up a timer to call a function at a specified future time.
  228.  
  229.  - Function: add-timeout SECS FUNCTION OBJECT &optional RESIGNAL
  230.      This function adds a timeout, to be signaled after the timeout
  231.      period has elapsed.  SECS is a number of seconds, expressed as an
  232.      integer or a float.  FUNCTION will be called after that many
  233.      seconds have elapsed, with one argument, the given OBJECT.  If the
  234.      optional RESIGNAL argument is provided, then after this timeout
  235.      expires, `add-timeout' will automatically be called again with
  236.      RESIGNAL as the first argument.
  237.  
  238.      This function returns an object which is the "id" of this
  239.      particular timeout.  You can pass that object to `disable-timeout'
  240.      to turn off the timeout before it has been signalled.
  241.  
  242.      The number of seconds may be expressed as a floating-point number,
  243.      in which case some fractional part of a second will be used.
  244.      Caveat: the usable timeout granularity will vary from system to
  245.      system.
  246.  
  247.      Adding a timeout causes a timeout event to be returned by
  248.      `next-event', and the function will be invoked by
  249.      `dispatch-event', so if XEmacs is in a tight loop, the function
  250.      will not be invoked until the next call to sit-for or until the
  251.      return to top-level (the same is true of process filters).
  252.  
  253.      WARNING: if you are thinking of calling add-timeout from inside of
  254.      a callback function as a way of resignalling a timeout, think
  255.      again.  There is a race condition.  That's why the RESIGNAL
  256.      argument exists.
  257.  
  258.      (NOTE: In FSF Emacs, this function is called `run-at-time' and has
  259.      different semantics.)
  260.  
  261.  - Function: disable-timeout ID
  262.      Cancel the requested action for ID, which should be a value
  263.      previously returned by `add-timeout'.  This cancels the effect of
  264.      that call to `add-timeout'; the arrival of the specified time will
  265.      not cause anything special to happen.  (NOTE: In FSF Emacs, this
  266.      function is called `cancel-timer'.)
  267.  
  268. 
  269. File: lispref.info,  Node: Terminal Input,  Next: Terminal Output,  Prev: Timers,  Up: System Interface
  270.  
  271. Terminal Input
  272. ==============
  273.  
  274.    This section describes functions and variables for recording or
  275. manipulating terminal input.  See *Note Display::, for related
  276. functions.
  277.  
  278. * Menu:
  279.  
  280. * Input Modes::        Options for how input is processed.
  281. * Translating Input::   Low level conversion of some characters or events
  282.               into others.
  283. * Recording Input::    Saving histories of recent or all input events.
  284.  
  285. 
  286. File: lispref.info,  Node: Input Modes,  Next: Translating Input,  Up: Terminal Input
  287.  
  288. Input Modes
  289. -----------
  290.  
  291.  - Function: set-input-mode INTERRUPT FLOW META QUIT-CHAR
  292.      This function sets the mode for reading keyboard input.  If
  293.      INTERRUPT is non-null, then XEmacs uses input interrupts.  If it is
  294.      `nil', then it uses CBREAK mode.  When XEmacs communicates
  295.      directly with X, it ignores this argument and uses interrupts if
  296.      that is the way it knows how to communicate.
  297.  
  298.      If FLOW is non-`nil', then XEmacs uses XON/XOFF (`C-q', `C-s')
  299.      flow control for output to the terminal.  This has no effect except
  300.      in CBREAK mode.  *Note Flow Control::.
  301.  
  302.      The default setting is system dependent.  Some systems always use
  303.      CBREAK mode regardless of what is specified.
  304.  
  305.      The argument META controls support for input character codes above
  306.      127.  If META is `t', XEmacs converts characters with the 8th bit
  307.      set into Meta characters.  If META is `nil', XEmacs disregards the
  308.      8th bit; this is necessary when the terminal uses it as a parity
  309.      bit.  If META is neither `t' nor `nil', XEmacs uses all 8 bits of
  310.      input unchanged.  This is good for terminals using European 8-bit
  311.      character sets.
  312.  
  313.      If QUIT-CHAR is non-`nil', it specifies the character to use for
  314.      quitting.  Normally this character is `C-g'.  *Note Quitting::.
  315.  
  316.    The `current-input-mode' function returns the input mode settings
  317. XEmacs is currently using.
  318.  
  319.  - Function: current-input-mode
  320.      This function returns current mode for reading keyboard input.  It
  321.      returns a list, corresponding to the arguments of `set-input-mode',
  322.      of the form `(INTERRUPT FLOW META QUIT)' in which:
  323.     INTERRUPT
  324.           is non-`nil' when XEmacs is using interrupt-driven input.  If
  325.           `nil', Emacs is using CBREAK mode.
  326.  
  327.     FLOW
  328.           is non-`nil' if XEmacs uses XON/XOFF (`C-q', `C-s') flow
  329.           control for output to the terminal.  This value has no effect
  330.           unless INTERRUPT is non-`nil'.
  331.  
  332.     META
  333.           is `t' if XEmacs treats the eighth bit of input characters as
  334.           the meta bit; `nil' means XEmacs clears the eighth bit of
  335.           every input character; any other value means XEmacs uses all
  336.           eight bits as the basic character code.
  337.  
  338.     QUIT
  339.           is the character XEmacs currently uses for quitting, usually
  340.           `C-g'.
  341.  
  342. 
  343. File: lispref.info,  Node: Translating Input,  Next: Recording Input,  Prev: Input Modes,  Up: Terminal Input
  344.  
  345. Translating Input Events
  346. ------------------------
  347.  
  348.    This section describes features for translating input events into
  349. other input events before they become part of key sequences.
  350.  
  351.  - Variable: function-key-map
  352.      This variable holds a keymap that describes the character sequences
  353.      sent by function keys on an ordinary character terminal.  This
  354.      keymap uses the same data structure as other keymaps, but is used
  355.      differently: it specifies translations to make while reading
  356.      events.
  357.  
  358.      If `function-key-map' "binds" a key sequence K to a vector V, then
  359.      when K appears as a subsequence *anywhere* in a key sequence, it
  360.      is replaced with the events in V.
  361.  
  362.      For example, VT100 terminals send `ESC O P' when the keypad PF1
  363.      key is pressed.  Therefore, we want XEmacs to translate that
  364.      sequence of events into the single event `pf1'.  We accomplish
  365.      this by "binding" `ESC O P' to `[pf1]' in `function-key-map', when
  366.      using a VT100.
  367.  
  368.      Thus, typing `C-c PF1' sends the character sequence `C-c ESC O P';
  369.      later the function `read-key-sequence' translates this back into
  370.      `C-c PF1', which it returns as the vector `[?\C-c pf1]'.
  371.  
  372.      Entries in `function-key-map' are ignored if they conflict with
  373.      bindings made in the minor mode, local, or global keymaps.  The
  374.      intent is that the character sequences that function keys send
  375.      should not have command bindings in their own right.
  376.  
  377.      The value of `function-key-map' is usually set up automatically
  378.      according to the terminal's Terminfo or Termcap entry, but
  379.      sometimes those need help from terminal-specific Lisp files.
  380.      XEmacs comes with terminal-specific files for many common
  381.      terminals; their main purpose is to make entries in
  382.      `function-key-map' beyond those that can be deduced from Termcap
  383.      and Terminfo.  *Note Terminal-Specific::.
  384.  
  385.      Emacs versions 18 and earlier used totally different means of
  386.      detecting the character sequences that represent function keys.
  387.  
  388.    The `iso-transl' library uses this feature to provide a way of
  389. inputting non-ASCII Latin-1 characters.
  390.  
  391. 
  392. File: lispref.info,  Node: Recording Input,  Prev: Translating Input,  Up: Terminal Input
  393.  
  394. Recording Input
  395. ---------------
  396.  
  397.  - Function: recent-keys
  398.      This function returns a vector containing the last 100 input events
  399.      from the keyboard or mouse.  All input events are included,
  400.      whether or not they were used as parts of key sequences.  Thus,
  401.      you always get the last 100 inputs, not counting keyboard macros.
  402.      (Events from keyboard macros are excluded because they are less
  403.      interesting for debugging; it should be enough to see the events
  404.      that invoked the macros.)
  405.  
  406.  - Command: open-dribble-file FILENAME
  407.      This function opens a "dribble file" named FILENAME.  When a
  408.      dribble file is open, each input event from the keyboard or mouse
  409.      (but not those from keyboard macros) is written in that file.  A
  410.      non-character event is expressed using its printed representation
  411.      surrounded by `<...>'.
  412.  
  413.      You close the dribble file by calling this function with an
  414.      argument of `nil'.
  415.  
  416.      This function is normally used to record the input necessary to
  417.      trigger an XEmacs bug, for the sake of a bug report.
  418.  
  419.           (open-dribble-file "~/dribble")
  420.                => nil
  421.  
  422.    See also the `open-termscript' function (*note Terminal Output::.).
  423.  
  424. 
  425. File: lispref.info,  Node: Terminal Output,  Next: Flow Control,  Prev: Terminal Input,  Up: System Interface
  426.  
  427. Terminal Output
  428. ===============
  429.  
  430.    The terminal output functions send output to the terminal or keep
  431. track of output sent to the terminal.  The variable `baud-rate' tells
  432. you what XEmacs thinks is the output speed of the terminal.
  433.  
  434.  - Variable: baud-rate
  435.      This variable's value is the output speed of the terminal, as far
  436.      as XEmacs knows.  Setting this variable does not change the speed
  437.      of actual data transmission, but the value is used for
  438.      calculations such as padding.  It also affects decisions about
  439.      whether to scroll part of the screen or repaint--even when using a
  440.      window system.  (We designed it this way despite the fact that a
  441.      window system has no true "output speed", to give you a way to
  442.      tune these decisions.)
  443.  
  444.      The value is measured in baud.
  445.  
  446.    If you are running across a network, and different parts of the
  447. network work at different baud rates, the value returned by XEmacs may
  448. be different from the value used by your local terminal.  Some network
  449. protocols communicate the local terminal speed to the remote machine, so
  450. that XEmacs and other programs can get the proper value, but others do
  451. not.  If XEmacs has the wrong value, it makes decisions that are less
  452. than optimal.  To fix the problem, set `baud-rate'.
  453.  
  454.  - Function: baud-rate
  455.      This function returns the value of the variable `baud-rate'.  In
  456.      Emacs versions 18 and earlier, this was the only way to find out
  457.      the terminal speed.
  458.  
  459.  - Function: send-string-to-terminal STRING
  460.      This function sends STRING to the terminal without alteration.
  461.      Control characters in STRING have terminal-dependent effects.
  462.  
  463.      One use of this function is to define function keys on terminals
  464.      that have downloadable function key definitions.  For example,
  465.      this is how on certain terminals to define function key 4 to move
  466.      forward four characters (by transmitting the characters `C-u C-f'
  467.      to the computer):
  468.  
  469.           (send-string-to-terminal "\eF4\^U\^F")
  470.                => nil
  471.  
  472.  - Command: open-termscript FILENAME
  473.      This function is used to open a "termscript file" that will record
  474.      all the characters sent by XEmacs to the terminal.  It returns
  475.      `nil'.  Termscript files are useful for investigating problems
  476.      where XEmacs garbles the screen, problems that are due to incorrect
  477.      Termcap entries or to undesirable settings of terminal options more
  478.      often than to actual XEmacs bugs.  Once you are certain which
  479.      characters were actually output, you can determine reliably
  480.      whether they correspond to the Termcap specifications in use.
  481.  
  482.      See also `open-dribble-file' in *Note Terminal Input::.
  483.  
  484.           (open-termscript "../junk/termscript")
  485.                => nil
  486.  
  487. 
  488. File: lispref.info,  Node: Flow Control,  Next: Batch Mode,  Prev: Terminal Output,  Up: System Interface
  489.  
  490. Flow Control
  491. ============
  492.  
  493.    This section attempts to answer the question "Why does XEmacs choose
  494. to use flow-control characters in its command character set?"  For a
  495. second view on this issue, read the comments on flow control in the
  496. `emacs/INSTALL' file from the distribution; for help with Termcap
  497. entries and DEC terminal concentrators, see `emacs/etc/TERMS'.
  498.  
  499.    At one time, most terminals did not need flow control, and none used
  500. `C-s' and `C-q' for flow control.  Therefore, the choice of `C-s' and
  501. `C-q' as command characters was uncontroversial.  XEmacs, for economy
  502. of keystrokes and portability, used nearly all the ASCII control
  503. characters, with mnemonic meanings when possible; thus, `C-s' for
  504. search and `C-q' for quote.
  505.  
  506.    Later, some terminals were introduced which required these characters
  507. for flow control.  They were not very good terminals for full-screen
  508. editing, so XEmacs maintainers did not pay attention.  In later years,
  509. flow control with `C-s' and `C-q' became widespread among terminals,
  510. but by this time it was usually an option.  And the majority of users,
  511. who can turn flow control off, were unwilling to switch to less
  512. mnemonic key bindings for the sake of flow control.
  513.  
  514.    So which usage is "right", XEmacs's or that of some terminal and
  515. concentrator manufacturers?  This question has no simple answer.
  516.  
  517.    One reason why we are reluctant to cater to the problems caused by
  518. `C-s' and `C-q' is that they are gratuitous.  There are other
  519. techniques (albeit less common in practice) for flow control that
  520. preserve transparency of the character stream.  Note also that their use
  521. for flow control is not an official standard.  Interestingly, on the
  522. model 33 teletype with a paper tape punch (which is very old), `C-s'
  523. and `C-q' were sent by the computer to turn the punch on and off!
  524.  
  525.    As X servers and other window systems replace character-only
  526. terminals, this problem is gradually being cured.  For the mean time,
  527. XEmacs provides a convenient way of enabling flow control if you want
  528. it: call the function `enable-flow-control'.
  529.  
  530.  - Function: enable-flow-control
  531.      This function enables use of `C-s' and `C-q' for output flow
  532.      control, and provides the characters `C-\' and `C-^' as aliases
  533.      for them using `keyboard-translate-table' (*note Translating
  534.      Input::.).
  535.  
  536.    You can use the function `enable-flow-control-on' in your `.emacs'
  537. file to enable flow control automatically on certain terminal types.
  538.  
  539.  - Function: enable-flow-control-on &rest TERMTYPES
  540.      This function enables flow control, and the aliases `C-\' and
  541.      `C-^', if the terminal type is one of TERMTYPES.  For example:
  542.  
  543.           (enable-flow-control-on "vt200" "vt300" "vt101" "vt131")
  544.  
  545.    Here is how `enable-flow-control' does its job:
  546.  
  547.   1. It sets CBREAK mode for terminal input, and tells the operating
  548.      system to handle flow control, with `(set-input-mode nil t)'.
  549.  
  550.   2. It sets up `keyboard-translate-table' to translate `C-\' and `C-^'
  551.      into `C-s' and `C-q'.  Except at its very lowest level, XEmacs
  552.      never knows that the characters typed were anything but `C-s' and
  553.      `C-q', so you can in effect type them as `C-\' and `C-^' even when
  554.      they are input for other commands.  *Note Translating Input::.
  555.  
  556.    If the terminal is the source of the flow control characters, then
  557. once you enable kernel flow control handling, you probably can make do
  558. with less padding than normal for that terminal.  You can reduce the
  559. amount of padding by customizing the Termcap entry.  You can also
  560. reduce it by setting `baud-rate' to a smaller value so that XEmacs uses
  561. a smaller speed when calculating the padding needed.  *Note Terminal
  562. Output::.
  563.  
  564. 
  565. File: lispref.info,  Node: Batch Mode,  Prev: Flow Control,  Up: System Interface
  566.  
  567. Batch Mode
  568. ==========
  569.  
  570.    The command line option `-batch' causes XEmacs to run
  571. noninteractively.  In this mode, XEmacs does not read commands from the
  572. terminal, it does not alter the terminal modes, and it does not expect
  573. to be outputting to an erasable screen.  The idea is that you specify
  574. Lisp programs to run; when they are finished, XEmacs should exit.  The
  575. way to specify the programs to run is with `-l FILE', which loads the
  576. library named FILE, and `-f FUNCTION', which calls FUNCTION with no
  577. arguments.
  578.  
  579.    Any Lisp program output that would normally go to the echo area,
  580. either using `message' or using `prin1', etc., with `t' as the stream,
  581. goes instead to XEmacs's standard error descriptor when in batch mode.
  582. Thus, XEmacs behaves much like a noninteractive application program.
  583. (The echo area output that XEmacs itself normally generates, such as
  584. command echoing, is suppressed entirely.)
  585.  
  586.  - Variable: noninteractive
  587.      This variable is non-`nil' when XEmacs is running in batch mode.
  588.  
  589. 
  590. File: lispref.info,  Node: X-Windows,  Next: ToolTalk Support,  Prev: System Interface,  Up: Top
  591.  
  592. Functions Specific to the X Window System
  593. *****************************************
  594.  
  595.    XEmacs provides the concept of "devices", which generalizes
  596. connections to an X server, a TTY device, etc.  Most information about
  597. an X server that XEmacs is connected to can be determined through
  598. general device functions.  *Note Devices::.  However, there are some
  599. features of the X Window System that do not generalize well, and they
  600. are covered specially here.
  601.  
  602. * Menu:
  603.  
  604. * X Selections::        Transferring text to and from other X clients.
  605. * X Server::            Information about the X server connected to
  606.                   a particular device.
  607. * X Miscellaneous::             Other X-specific functions and variables.
  608.  
  609. 
  610. File: lispref.info,  Node: X Selections,  Next: X Server,  Up: X-Windows
  611.  
  612. X Selections
  613. ============
  614.  
  615.    The X server records a set of "selections" which permit transfer of
  616. data between application programs.  The various selections are
  617. distinguished by "selection types", represented in XEmacs by symbols.
  618. X clients including XEmacs can read or set the selection for any given
  619. type.
  620.  
  621.  - Function: x-own-selection DATA &optional TYPE
  622.      This function sets a "selection" in the X server.  It takes two
  623.      arguments: a value, DATA, and the selection type TYPE to assign it
  624.      to.  DATA may be a string, a cons of two markers, or an extent.
  625.      In the latter cases, the selection is considered to be the text
  626.      between the markers, or between the extent's endpoints.
  627.  
  628.      Each possible TYPE has its own selection value, which changes
  629.      independently.  The usual values of TYPE are `PRIMARY' and
  630.      `SECONDARY'; these are symbols with upper-case names, in accord
  631.      with X Windows conventions.  The default is `PRIMARY'.
  632.  
  633.      (In FSF Emacs, this function is called `x-set-selection' and takes
  634.      different arguments.)
  635.  
  636.  - Function: x-get-selection
  637.      This function accesses selections set up by XEmacs or by other X
  638.      clients.  It returns the value of the current primary selection.
  639.  
  640.  - Function: x-disown-selection &optional SECONDARY-P
  641.      Assuming we own the selection, this function disowns it.  If
  642.      SECONDARY-P is non-`nil', the secondary selection instead of the
  643.      primary selection is discarded.
  644.  
  645.    The X server also has a set of numbered "cut buffers" which can
  646. store text or other data being moved between applications.  Cut buffers
  647. are considered obsolete, but XEmacs supports them for the sake of X
  648. clients that still use them.
  649.  
  650.  - Function: x-get-cutbuffer &optional N
  651.      This function returns the contents of cut buffer number N. (This
  652.      function is called `x-get-cut-buffer' in FSF Emacs.)
  653.  
  654.  - Function: x-store-cutbuffer STRING
  655.      This function stores STRING into the first cut buffer (cut buffer
  656.      0), moving the other values down through the series of cut buffers,
  657.      kill-ring-style. (This function is called `x-set-cut-buffer' in FSF
  658.      Emacs.)
  659.  
  660. 
  661. File: lispref.info,  Node: X Server,  Next: X Miscellaneous,  Prev: X Selections,  Up: X-Windows
  662.  
  663. X Server
  664. ========
  665.  
  666.    This section describes how to access and change the overall status of
  667. the X server XEmacs is using.
  668.  
  669. * Menu:
  670.  
  671. * Resources::            Getting resource values from the server.
  672. * Server Data::            Getting info about the X server.
  673. * Grabs::            Restricting access to the server by other apps.
  674.  
  675. 
  676. File: lispref.info,  Node: Resources,  Next: Server Data,  Up: X Server
  677.  
  678. Resources
  679. ---------
  680.  
  681.  - Function: default-x-device
  682.      This function return the default X device for resourcing.  This is
  683.      the first-created X device that still exists.
  684.  
  685.  - Function: x-get-resource NAME CLASS TYPE &optional LOCALE DEVICE
  686.           NOERROR
  687.      This function retrieves a resource value from the X resource
  688.      manager.
  689.  
  690.         * The first arg is the name of the resource to retrieve, such as
  691.           `"font"'.
  692.  
  693.         * The second arg is the class of the resource to retrieve, like
  694.           `"Font"'.
  695.  
  696.         * The third arg should be one of the symbols `string',
  697.           `integer', `natnum', or `boolean', specifying the type of
  698.           object that the database is searched for.
  699.  
  700.         * The fourth arg is the locale to search for the resources on,
  701.           and can currently be a a buffer, a frame, a device, or the
  702.           symbol `global'.  If omitted, it defaults to `global'.
  703.  
  704.         * The fifth arg is the device to search for the resources on.
  705.           (The resource database for a particular device is constructed
  706.           by combining non-device- specific resources such any
  707.           command-line resources specified and any app-defaults files
  708.           found [or the fallback resources supplied by XEmacs, if no
  709.           app-defaults file is found] with device-specific resources
  710.           such as those supplied using `xrdb'.) If omitted, it defaults
  711.           to the device of LOCALE, if a device can be derived (i.e. if
  712.           LOCALE is a frame or device), and otherwise defaults to the
  713.           value of `default-x-device'.
  714.  
  715.         * The sixth arg NOERROR, if non-`nil', means do not signal an
  716.           error if a bogus resource specification was retrieved (e.g.
  717.           if a non-integer was given when an integer was requested).
  718.           In this case, a warning is issued instead.
  719.  
  720.      The resource names passed to this function are looked up relative
  721.      to the locale.
  722.  
  723.      If you want to search for a subresource, you just need to specify
  724.      the resource levels in NAME and CLASS.  For example, NAME could be
  725.      `"modeline.attributeFont"', and CLASS `"Face.AttributeFont"'.
  726.  
  727.      Specifically,
  728.  
  729.        1. If LOCALE is a buffer, a call
  730.  
  731.                    `(x-get-resource "foreground" "Foreground" 'string SOME-BUFFER)'
  732.  
  733.           is an interface to a C call something like
  734.  
  735.                    `XrmGetResource (db, "xemacs.buffer.BUFFER-NAME.foreground",
  736.                            "Emacs.EmacsLocaleType.EmacsBuffer.Foreground",
  737.                            "String");'
  738.  
  739.        2. If LOCALE is a frame, a call
  740.  
  741.                    `(x-get-resource "foreground" "Foreground" 'string SOME-FRAME)'
  742.  
  743.           is an interface to a C call something like
  744.  
  745.                    `XrmGetResource (db, "xemacs.frame.FRAME-NAME.foreground",
  746.                            "Emacs.EmacsLocaleType.EmacsFrame.Foreground",
  747.                            "String");'
  748.  
  749.        3. If LOCALE is a device, a call
  750.  
  751.                    `(x-get-resource "foreground" "Foreground" 'string SOME-DEVICE)'
  752.  
  753.           is an interface to a C call something like
  754.  
  755.                    `XrmGetResource (db, "xemacs.device.DEVICE-NAME.foreground",
  756.                            "Emacs.EmacsLocaleType.EmacsDevice.Foreground",
  757.                            "String");'
  758.  
  759.        4. If LOCALE is the symbol `global', a call
  760.  
  761.                    `(x-get-resource "foreground" "Foreground" 'string 'global)'
  762.  
  763.           is an interface to a C call something like
  764.  
  765.                    `XrmGetResource (db, "xemacs.foreground",
  766.                            "Emacs.Foreground",
  767.                            "String");'
  768.  
  769.      Note that for `global', no prefix is added other than that of the
  770.      application itself; thus, you can use this locale to retrieve
  771.      arbitrary application resources, if you really want to.
  772.  
  773.      The returned value of this function is `nil' if the queried
  774.      resource is not found.  If TYPE is `string', a string is returned,
  775.      and if it is `integer', an integer is returned.  If TYPE is
  776.      `boolean', then the returned value is the list `(t)' for true,
  777.      `(nil)' for false, and is `nil' to mean "unspecified".
  778.  
  779.  - Function: x-put-resource RESOURCE-LINE &optional DEVICE
  780.      This function adds a resource to the resource database for DEVICE.
  781.      RESOURCE-LINE specifies the resource to add and should be a
  782.      standard resource specification.
  783.  
  784.  - Variable: x-emacs-application-class
  785.      This variable holds The X application class of the XEmacs process.
  786.      This controls, among other things, the name of the "app-defaults"
  787.      file that XEmacs will use.  For changes to this variable to take
  788.      effect, they must be made before the connection to the X server is
  789.      initialized, that is, this variable may only be changed before
  790.      XEmacs is dumped, or by setting it in the file
  791.      `lisp/term/x-win.el'.
  792.  
  793. 
  794. File: lispref.info,  Node: Server Data,  Next: Grabs,  Prev: Resources,  Up: X Server
  795.  
  796. Data about the X Server
  797. -----------------------
  798.  
  799.    This section describes functions and a variable that you can use to
  800. get information about the capabilities and origin of the X server
  801. corresponding to a particular device.  The device argument is generally
  802. optional and defaults to the selected device.
  803.  
  804.  - Function: x-server-version &optional DEVICE
  805.      This function returns the list of version numbers of the X server
  806.      DEVICE is on.  The returned value is a list of three integers: the
  807.      major and minor version numbers of the X protocol in use, and the
  808.      vendor-specific release number.
  809.  
  810.  - Function: x-server-vendor &optional DEVICE
  811.      This function returns the vendor supporting the X server DEVICE is
  812.      on.
  813.  
  814.  - Function: x-display-visual-class &optional DEVICE
  815.      This function returns the visual class of the display DEVICE is
  816.      on.  The value is one of the symbols `static-gray', `gray-scale',
  817.      `static-color', `pseudo-color', `true-color', and `direct-color'.
  818.      (Note that this is different from previous versions of XEmacs,
  819.      which returned `StaticGray', `GrayScale', etc.)
  820.  
  821. 
  822. File: lispref.info,  Node: Grabs,  Prev: Server Data,  Up: X Server
  823.  
  824. Restricting Access to the Server by Other Apps
  825. ----------------------------------------------
  826.  
  827.  - Function: x-grab-keyboard &optional DEVICE
  828.      This function grabs the keyboard on the given device (defaulting
  829.      to the selected one).  So long as the keyboard is grabbed, all
  830.      keyboard events will be delivered to XEmacs - it is not possible
  831.      for other X clients to eavesdrop on them.  Ungrab the keyboard
  832.      with `x-ungrab-keyboard' (use an `unwind-protect').  Returns `t'
  833.      if the grab was successful; `nil' otherwise.
  834.  
  835.  - Function: x-ungrab-keyboard &optional DEVICE
  836.      This function releases a keyboard grab made with `x-grab-keyboard'.
  837.  
  838.  - Function: x-grab-pointer &optional DEVICE CURSOR IGNORE-KEYBOARD
  839.      This function grabs the pointer and restricts it to its current
  840.      window.  If optional DEVICE argument is `nil', the selected device
  841.      will be used.  If optional CURSOR argument is non-`nil', change
  842.      the pointer shape to that until `x-ungrab-pointer' is called (it
  843.      should be an object returned by the `make-cursor' function).  If
  844.      the second optional argument IGNORE-KEYBOARD is non-`nil', ignore
  845.      all keyboard events during the grab.  Returns `t' if the grab is
  846.      successful, `nil' otherwise.
  847.  
  848.  - Function: x-ungrab-pointer &optional DEVICE
  849.      This function releases a pointer grab made with `x-grab-pointer'.
  850.      If optional first arg DEVICE is `nil' the selected device is used.
  851.      If it is `t' the pointer will be released on all X devices.
  852.  
  853. 
  854. File: lispref.info,  Node: X Miscellaneous,  Prev: X Server,  Up: X-Windows
  855.  
  856. Miscellaneous X Functions and Variables
  857. =======================================
  858.  
  859.  - Variable: x-bitmap-file-path
  860.      This variable holds a list of the directories in which X bitmap
  861.      files may be found.  If `nil', this is initialized from the
  862.      `"*bitmapFilePath"' resource.  This is used by the
  863.      `make-image-instance' function (however, note that if the
  864.      environment variable `XBMLANGPATH' is set, it is consulted first).
  865.  
  866.  - Variable: x-library-search-path
  867.      This variable holds the search path used by `read-color' to find
  868.      `rgb.txt'.
  869.  
  870.  - Function: x-valid-keysym-name-p KEYSYM
  871.      This function returns true if KEYSYM names a keysym that the X
  872.      library knows about.  Valid keysyms are listed in the files
  873.      `/usr/include/X11/keysymdef.h' and in `/usr/lib/X11/XKeysymDB', or
  874.      whatever the equivalents are on your system.
  875.  
  876.  - Function: x-window-id &optional FRAME
  877.      This function returns the ID of the X11 window.  This gives us a
  878.      chance to manipulate the Emacs window from within a different
  879.      program.  Since the ID is an unsigned long, we return it as a
  880.      string.
  881.  
  882.  - Variable: x-allow-sendevents
  883.      If non-`nil', synthetic events are allowed.  `nil' means they are
  884.      ignored.  Beware: allowing XEmacs to process SendEvents opens a
  885.      big security hole.
  886.  
  887.  - Function: x-debug-mode ARG &optional DEVICE
  888.      With a true arg, make the connection to the X server synchronous.
  889.      With false, make it asynchronous.  Synchronous connections are
  890.      much slower, but are useful for debugging. (If you get X errors,
  891.      make the connection synchronous, and use a debugger to set a
  892.      breakpoint on `x_error_handler'.  Your backtrace of the C stack
  893.      will now be useful.  In asynchronous mode, the stack above
  894.      `x_error_handler' isn't helpful because of buffering.)  If DEVICE
  895.      is not specified, the selected device is assumed.
  896.  
  897.      Calling this function is the same as calling the C function
  898.      `XSynchronize', or starting the program with the `-sync' command
  899.      line argument.
  900.  
  901.  - Variable: x-debug-events
  902.      If non-zero, debug information about events that XEmacs sees is
  903.      displayed.  Information is displayed on stderr.  Currently defined
  904.      values are:
  905.  
  906.         * 1 == non-verbose output
  907.  
  908.         * 2 == verbose output
  909.  
  910. 
  911. File: lispref.info,  Node: ToolTalk Support,  Next: Internationalization,  Prev: X-Windows,  Up: Top
  912.  
  913. ToolTalk Support
  914. ****************
  915.  
  916. * Menu:
  917.  
  918. * XEmacs ToolTalk API Summary::
  919. * Sending Messages::
  920. * Receiving Messages::
  921.  
  922. 
  923. File: lispref.info,  Node: XEmacs ToolTalk API Summary,  Next: Sending Messages,  Up: ToolTalk Support
  924.  
  925. XEmacs ToolTalk API Summary
  926. ===========================
  927.  
  928.    The Emacs Lisp interface to ToolTalk is similar, at least in spirit,
  929. to the standard C ToolTalk API.  Only the message and pattern parts of
  930. the API are supported at present; more of the API could be added if
  931. needed.  The Lisp interface departs from the C API in a few ways:
  932.  
  933.    * ToolTalk is initialized automatically at XEmacs startup-time.
  934.      Messages can only be sent other ToolTalk applications connected to
  935.      the same X11 server that XEmacs is running on.
  936.  
  937.    * There are fewer entry points; polymorphic functions with keyword
  938.      arguments are used instead.
  939.  
  940.    * The callback interface is simpler and marginally less functional.
  941.      A single callback may be associated with a message or a pattern;
  942.      the callback is specified with a Lisp symbol (the symbol should
  943.      have a function binding).
  944.  
  945.    * The session attribute for messages and patterns is always
  946.      initialized to the default session.
  947.  
  948.    * Anywhere a ToolTalk enum constant, e.g. `TT_SESSION', is valid, one
  949.      can substitute the corresponding symbol, e.g. `'TT_SESSION'.  This
  950.      simplifies building lists that represent messages and patterns.
  951.  
  952. 
  953. File: lispref.info,  Node: Sending Messages,  Next: Receiving Messages,  Prev: XEmacs ToolTalk API Summary,  Up: ToolTalk Support
  954.  
  955. Sending Messages
  956. ================
  957.  
  958. * Menu:
  959.  
  960. * Example of Sending Messages::
  961. * Elisp Interface for Sending Messages::
  962.  
  963. 
  964. File: lispref.info,  Node: Example of Sending Messages,  Next: Elisp Interface for Sending Messages,  Up: Sending Messages
  965.  
  966. Example of Sending Messages
  967. ---------------------------
  968.  
  969.    Here's a simple example that sends a query to another application
  970. and then displays its reply.  Both the query and the reply are stored
  971. in the first argument of the message.
  972.  
  973.      (defun tooltalk-random-query-handler (msg)
  974.        (let ((state (get-tooltalk-message-attribute msg 'state)))
  975.          (cond
  976.            ((eq state 'TT_HANDLED)
  977.             (message (get-tooltalk-message-attribute msg arg_val 0)))
  978.            ((memq state '(TT_FAILED TT_REJECTED))
  979.             (message "Random query turns up nothing")))))
  980.      
  981.      (defvar random-query-message
  982.        '(   class TT_REQUEST
  983.             scope TT_SESSION
  984.           address TT_PROCEDURE
  985.                op "random-query"
  986.              args '((TT_INOUT "?" "string"))
  987.          callback tooltalk-random-query-handler))
  988.      
  989.      (let ((m (make-tooltalk-message random-query-message)))
  990.        (send-tooltalk-message m))
  991.  
  992. 
  993. File: lispref.info,  Node: Elisp Interface for Sending Messages,  Prev: Example of Sending Messages,  Up: Sending Messages
  994.  
  995. Elisp Interface for Sending Messages
  996. ------------------------------------
  997.  
  998.  - Function: make-tooltalk-message ATTRIBUTES
  999.      Create a ToolTalk message and initialize its attributes.  The
  1000.      value of ATTRIBUTES must be a list of alternating keyword/values,
  1001.      where keywords are symbols that name valid message attributes.
  1002.      For example:
  1003.  
  1004.             (make-tooltalk-message
  1005.               '(class TT_NOTICE
  1006.                 scope TT_SESSION
  1007.                 address TT_PROCEDURE
  1008.                 op "do-something"
  1009.                 args ("arg1" 12345 (TT_INOUT "arg3" "string"))))
  1010.  
  1011.      Values must always be strings, integers, or symbols that represent
  1012.      ToolTalk constants.  Attribute names are the same as those
  1013.      supported by `set-tooltalk-message-attribute', plus `args'.
  1014.  
  1015.      The value of `args' should be a list of message arguments where
  1016.      each message argument has the following form:
  1017.  
  1018.              `(mode [value [type]])' or just `value'
  1019.  
  1020.      Where MODE is one of `TT_IN', `TT_OUT', or `TT_INOUT' and TYPE is
  1021.      a string.  If TYPE isn't specified then `int' is used if VALUE is
  1022.      a number; otherwise `string' is used.  If TYPE is `string' then
  1023.      VALUE is converted to a string (if it isn't a string already) with
  1024.      `prin1-to-string'.  If only a value is specified then MODE
  1025.      defaults to `TT_IN'.  If MODE is `TT_OUT' then VALUE and TYPE
  1026.      don't need to be specified.  You can find out more about the
  1027.      semantics and uses of ToolTalk message arguments in chapter 4 of
  1028.      the `ToolTalk Programmer's Guide'.
  1029.  
  1030.  
  1031.  - Function: send-tooltalk-message MSG
  1032.      Send the message on its way.  Once the message has been sent it's
  1033.      almost always a good idea to get rid of it with
  1034.      `destroy-tooltalk-message'.
  1035.  
  1036.  
  1037.  - Function: return-tooltalk-message MSG &optional MODE
  1038.      Send a reply to this message.  The second argument can be `reply',
  1039.      `reject' or `fail'; the default is `reply'.  Before sending a
  1040.      reply, all message arguments whose mode is `TT_INOUT' or `TT_OUT'
  1041.      should have been filled in - see `set-tooltalk-message-attribute'.
  1042.  
  1043.  
  1044.  - Function: get-tooltalk-message-attribute MSG ATTRIBUTE &optional ARGN
  1045.      Returns the indicated ToolTalk message attribute.  Attributes are
  1046.      identified by symbols with the same name (underscores and all) as
  1047.      the suffix of the ToolTalk `tt_message_<attribute>' function that
  1048.      extracts the value.  String attribute values are copied and
  1049.      enumerated type values (except disposition) are converted to
  1050.      symbols; e.g. `TT_HANDLER' is `'TT_HANDLER', `uid' and `gid' are
  1051.      represented by fixnums (small integers), `opnum' is converted to a
  1052.      string, and `disposition' is converted to a fixnum.  We convert
  1053.      `opnum' (a C int) to a string (e.g. `123' => `"123"') because
  1054.      there's no guarantee that opnums will fit within the range of
  1055.      Emacs Lisp integers.
  1056.  
  1057.      [TBD] Use the `plist' attribute instead of C API `user' attribute
  1058.      for user-defined message data.  To retrieve the value of a message
  1059.      property, specify the indicator for ARGN.  For example, to get the
  1060.      value of a property called `rflag', use
  1061.  
  1062.              (get-tooltalk-message-attribute msg 'plist 'rflag)
  1063.  
  1064.      To get the value of a message argument use one of the `arg_val'
  1065.      (strings), `arg_ival' (integers), or `arg_bval' (strings with
  1066.      embedded nulls), attributes.  For example, to get the integer
  1067.      value of the third argument:
  1068.  
  1069.              (get-tooltalk-message-attribute msg 'arg_ival 2)
  1070.  
  1071.      As you can see, argument numbers are zero-based.  The type of each
  1072.      arguments can be retrieved with the `arg_type' attribute; however
  1073.      ToolTalk doesn't define any semantics for the string value of
  1074.      `arg_type'.  Conventionally `string' is used for strings and `int'
  1075.      for 32 bit integers.  Note that Emacs Lisp stores the lengths of
  1076.      strings explicitly (unlike C) so treating the value returned by
  1077.      `arg_bval' like a string is fine.
  1078.  
  1079.  
  1080.  - Function: set-tooltalk-message-attribute VALUE MSG ATTRIBUTE
  1081.           &optional ARGN
  1082.      Initialize one ToolTalk message attribute.
  1083.  
  1084.      Attribute names and values are the same as for
  1085.      `get-tooltalk-message-attribute'.  A property list is provided for
  1086.      user data (instead of the `user' message attribute); see
  1087.      `get-tooltalk-message-attribute'.
  1088.  
  1089.      Callbacks are handled slightly differently than in the C ToolTalk
  1090.      API.  The value of CALLBACK should be the name of a function of one
  1091.      argument.  It will be called each time the state of the message
  1092.      changes.  This is usually used to notice when the message's state
  1093.      has changed to `TT_HANDLED' (or `TT_FAILED'), so that reply
  1094.      argument values can be used.
  1095.  
  1096.      If one of the argument attributes is specified as `arg_val',
  1097.      `arg_ival', or `arg_bval', then ARGN must be the number of an
  1098.      already created argument.  Arguments can be added to a message
  1099.      with `add-tooltalk-message-arg'.
  1100.  
  1101.  
  1102.  - Function: add-tooltalk-message-arg MSG MODE TYPE &optional VALUE
  1103.      Append one new argument to the message.  MODE must be one of
  1104.      `TT_IN', `TT_INOUT', or `TT_OUT', TYPE must be a string, and VALUE
  1105.      can be a string or an integer.  ToolTalk doesn't define any
  1106.      semantics for TYPE, so only the participants in the protocol
  1107.      you're using need to agree what types mean (if anything).
  1108.      Conventionally `string' is used for strings and `int' for 32 bit
  1109.      integers.  Arguments can initialized by providing a value or with
  1110.      `set-tooltalk-message-attribute'; the latter is neccessary if you
  1111.      want to initialize the argument with a string that can contain
  1112.      embedded nulls (use `arg_bval').
  1113.  
  1114.  
  1115.  - Function: create-tooltalk-message
  1116.      Create a new ToolTalk message.  The message's session attribute is
  1117.      initialized to the default session.  Other attributes can be
  1118.      intialized with `set-tooltalk-message-attribute'.
  1119.      `make-tooltalk-message' is the preferred way to create and
  1120.      initialize a message.
  1121.  
  1122.  
  1123.  - Function: destroy-tooltalk-message MSG
  1124.      Apply `tt_message_destroy' to the message.  It's not necessary to
  1125.      destroy messages after they've been processed by a message or
  1126.      pattern callback, the Lisp/ToolTalk callback machinery does this
  1127.      for you.
  1128.  
  1129. 
  1130. File: lispref.info,  Node: Receiving Messages,  Prev: Sending Messages,  Up: ToolTalk Support
  1131.  
  1132. Receiving Messages
  1133. ==================
  1134.  
  1135. * Menu:
  1136.  
  1137. * Example of Receiving Messages::
  1138. * Elisp Interface for Receiving Messages::
  1139.  
  1140. 
  1141. File: lispref.info,  Node: Example of Receiving Messages,  Next: Elisp Interface for Receiving Messages,  Up: Receiving Messages
  1142.  
  1143. Example of Receiving Messages
  1144. -----------------------------
  1145.  
  1146.    Here's a simple example of a handler for a message that tells XEmacs
  1147. to display a string in the mini-buffer area.  The message operation is
  1148. called `emacs-display-string'.  Its first (0th) argument is the string
  1149. to display.
  1150.  
  1151.      (defun tooltalk-display-string-handler (msg)
  1152.        (message (get-tooltalk-message-attribute msg 'arg_val 0)))
  1153.      
  1154.      (defvar display-string-pattern
  1155.        '(category TT_HANDLE
  1156.             scope TT_SESSION
  1157.                op "emacs-display-string"
  1158.          callback tooltalk-display-string-handler))
  1159.      
  1160.      (let ((p (make-tooltalk-pattern display-string-pattern)))
  1161.        (register-tooltalk-pattern p))
  1162.  
  1163. 
  1164. File: lispref.info,  Node: Elisp Interface for Receiving Messages,  Prev: Example of Receiving Messages,  Up: Receiving Messages
  1165.  
  1166. Elisp Interface for Receiving Messages
  1167. --------------------------------------
  1168.  
  1169.  - Function: make-tooltalk-pattern ATTRIBUTES
  1170.      Create a ToolTalk pattern and initialize its attributes.  The
  1171.      value of attributes must be a list of alternating keyword/values,
  1172.      where keywords are symbols that name valid pattern attributes or
  1173.      lists of valid attributes.  For example:
  1174.  
  1175.             (make-tooltalk-pattern
  1176.               '(category TT_OBSERVE
  1177.                    scope TT_SESSION
  1178.                       op ("operation1" "operation2")
  1179.                     args ("arg1" 12345 (TT_INOUT "arg3" "string"))))
  1180.  
  1181.      Attribute names are the same as those supported by
  1182.      `add-tooltalk-pattern-attribute', plus `'args'.
  1183.  
  1184.      Values must always be strings, integers, or symbols that represent
  1185.      ToolTalk constants or lists of same.  When a list of values is
  1186.      provided all of the list elements are added to the attribute.  In
  1187.      the example above, messages whose `op' attribute is `"operation1"'
  1188.      or `"operation2"' would match the pattern.
  1189.  
  1190.      The value of ARGS should be a list of pattern arguments where each
  1191.      pattern argument has the following form:
  1192.  
  1193.              `(mode [value [type]])' or just `value'
  1194.  
  1195.      Where MODE is one of `TT_IN', `TT_OUT', or `TT_INOUT' and TYPE is
  1196.      a string.  If TYPE isn't specified then `int' is used if VALUE is
  1197.      a number; otherwise `string' is used.  If TYPE is `string' then
  1198.      VALUE is converted to a string (if it isn't a string already) with
  1199.      `prin1-to-string'.  If only a value is specified then MODE
  1200.      defaults to `TT_IN'.  If MODE is `TT_OUT' then VALUE and TYPE
  1201.      don't need to be specified.  You can find out more about the
  1202.      semantics and uses of ToolTalk pattern arguments in chapter 3 of
  1203.      the `ToolTalk Programmer's Guide'.
  1204.  
  1205.  
  1206.  - Function: register-tooltalk-pattern PAT
  1207.      XEmacs will begin receiving messages that match this pattern.
  1208.  
  1209.  - Function: unregister-tooltalk-pattern PAT
  1210.      XEmacs will stop receiving messages that match this pattern.
  1211.  
  1212.  - Function: add-tooltalk-pattern-attribute VALUE PAT INDICATOR
  1213.      Add one value to the indicated pattern attribute. The names of
  1214.      attributes are the same as the ToolTalk accessors used to set them
  1215.      less the `tooltalk_pattern_' prefix and the `_add' suffix.  For
  1216.      example, the name of the attribute for the
  1217.      `tt_pattern_disposition_add' attribute is `disposition'.  The
  1218.      `category' attribute is handled specially, since a pattern can only
  1219.      be a member of one category (`TT_OBSERVE' or `TT_HANDLE').
  1220.  
  1221.      Callbacks are handled slightly differently than in the C ToolTalk
  1222.      API.  The value of CALLBACK should be the name of a function of one
  1223.      argument.  It will be called each time the pattern matches an
  1224.      incoming message.
  1225.  
  1226.  - Function: add-tooltalk-pattern-arg PAT MODE TYPE VALUE
  1227.      Add one fully-specified argument to a ToolTalk pattern.  MODE must
  1228.      be one of `TT_IN', `TT_INOUT', or `TT_OUT'.  TYPE must be a
  1229.      string.  VALUE can be an integer, string or `nil'.  If VALUE is an
  1230.      integer then an integer argument (`tt_pattern_iarg_add') is added;
  1231.      otherwise a string argument is added.  At present there's no way
  1232.      to add a binary data argument.
  1233.  
  1234.  
  1235.  - Function: create-tooltalk-pattern
  1236.      Create a new ToolTalk pattern and initialize its session attribute
  1237.      to be the default session.
  1238.  
  1239.  - Function: destroy-tooltalk-pattern PAT
  1240.      Apply `tt_pattern_destroy' to the pattern.  This effectively
  1241.      unregisters the pattern.
  1242.  
  1243.  - Function: describe-tooltalk-message MSG &optional STREAM
  1244.      Print the message's attributes and arguments to STREAM.  This is
  1245.      often useful for debugging.
  1246.  
  1247. 
  1248. File: lispref.info,  Node: Internationalization,  Next: Tips,  Prev: ToolTalk Support,  Up: Top
  1249.  
  1250. Internationalization
  1251. ********************
  1252.  
  1253. * Menu:
  1254.  
  1255. * I18N Levels 1 and 2::
  1256. * I18N Level 3::
  1257. * I18N Level 4::
  1258.  
  1259. 
  1260. File: lispref.info,  Node: I18N Levels 1 and 2,  Next: I18N Level 3,  Up: Internationalization
  1261.  
  1262. I18N Levels 1 and 2
  1263. ===================
  1264.  
  1265.    XEmacs is now compliant with I18N levels 1 and 2.  Specifically,
  1266. this means that it is 8-bit clean and correctly handles time and date
  1267. functions.  XEmacs will correctly display the entire ISO-Latin 1
  1268. character set.
  1269.  
  1270.    The compose key may now be used to create any character in the
  1271. ISO-Latin 1 character set not directly available via the keyboard..  In
  1272. order for the compose key to work it is necessary to load the file
  1273. `x-compose.el'.  At any time while composing a character, `C-h' will
  1274. display all valid completions and the character which would be produced.
  1275.  
  1276.